<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-list.php");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <?php include 'modules/head.php'; ?>
    <link href="../asset/css/style.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        .els1{ position: relative; text-indent: 10px;}
        .notice_icon{width: 10px;
            height: 10px;
            display: block;
            position: absolute;
            background: #f00;
            border-radius: 15px;
            top: 0px;}
        .layui-btn{position: relative; }
        .layui-btn .notice_icon{top: 0px;right: 3px;}
    </style>
</head>


<body>

<div id="topbar">
    <?php include ROOT_PATH_.'/controller/common/module/topbar.php'; ?>
</div>

<div id="container" class="<? echo $system_part ?>">


        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/module/sidebar.php'; ?>
        </div>





        <div id="content">
                <?php $page_title='任务列表';?>
                <?php include ROOT_PATH_.'/controller/common/module/mod-page-title.php'; ?>

                <?php include 'modules/mod-search.php'; ?>
                <?php include 'modules/mod-function.php'; ?>









<!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
<div class="list-box">

<div class="list-boxes">







<table class="layui-table">
  <colgroup>
                            <col width="45">
                            <col width="280">
                            <col width="80">
                            <col width="100">
                            <col width="150">
                            <col width="200">
                            <col>
                            <col width="80">
                            <col width="85">
                            <col width="180">





  </colgroup>
  <thead>
    <tr>
      <th></th>
      <th>任务</th>
      <th>执行人</th>
      <th>开始时间</th>
      <th>截止时间</th>
      <th>项目</th>
      <th>备注</th>
      <th>优先级</th>
      <th>状态</th>
      <th>操作</th>
    </tr>
  </thead>  
  <tbody>





  <?php
	for ($i = 0; $i < $detailnum; $i++) {
    ?>
        <tr id="item<?echo $detail[$i]['nid']?>" >
        <td><?echo $i+1+$plate['page_list_num']*($nowpageid-1) ?>
        <? //echo count_days(date("Y-m-d"),$detail[$i]['enddate'])?>
        </td>
        <td><div class="els1"><?php if($detail[$i]['notice_show'] == 1) {?><i class="notice_icon"></i><?php }?><?echo $detail[$i]['title']?></div></td>

    <?
        $principal=select_one_line_all_items($table_Prefix."employee","nid = '".$detail[$i]['principal']."'");
    ?>
    <td><?echo $principal['name'] ?: '无'?></td>

 
    <td><?echo substr($detail[$i]['startdate'],5,5)?></td>

    <?php 
        //获取当前时间 
        $now      = strtotime("now");
        //获取当前日期
        $now_date = date('Y-m-d');
        //获取任务截止时间
        $end_time = strtotime($detail[$i]['enddate']);
        //获取任务截止日期
        $end_date = date('Y-m-d',$end_time);
    ?>
    <!-- 超时则改变字体颜色 -->
    <!--//todo 这部分的代码，写得有点恐怖，要优化一下简单易懂，仿照下面status的写法-->
    <td>
        <span class="layui-badge <?php if(($now_date == $end_date) and $detail[$i]['status'] != "已完成")
            {if($now > $end_time){echo "layui-bg-orange";}}else if(($now > $end_time) and $detail[$i]['status'] != "已完成")
            {echo "layui-bg-red";}else{echo "layui-bg-green";}?>"  >
            <?echo  str_replace('-', '月', substr($detail[$i]['enddate'],5,5));?>日
             </span>
           <span class="layui-badge <?php if(($now_date == $end_date) and $detail[$i]['status'] != "已完成")
            {if($now > $end_time){echo "layui-bg-orange";}}else if(($now > $end_time) and $detail[$i]['status'] != "已完成")
           {echo "layui-bg-red";}else{echo "layui-bg-green";}?>"  >
            <?php if(number2Chinese_number(date('w',strtotime($detail[$i]['enddate']))) == "零"){
                echo "星期天";
            }else{
                echo  "星期".number2Chinese_number(date('w', strtotime($detail[$i]['enddate'])));
            }; ?>
        </span>
    </td>
    <?
        $case=select_one_line_all_items($table_Prefix."case","nid = '".$detail[$i]['case_id']."'");
        $unit=select_one_line_all_items($table_Prefix."unit","nid = '".$case['unit']."'");

       $p['len']=4;
       $p['from']=0;
       $p['str']=$unit['sname']?:$unit['name'];
    ?>

    <td>
        <span class="layui-badge layui-bg-blue" style="float: left"><?echo utf8_substr($p)?: '暂未设置'?></span>
        <span class="els1"><?echo $case['name'] ?: '暂未设置'?></span>
    </td>

    <?php
        $note = cleanhtml($detail[$i]['note']);
    ?>
    <td><div class="els1" id="<?php echo 'note'.$detail[$i]['nid'] ?>" style="cursor: pointer"
             onclick="layer_show_by_id('<?php echo 'note'.$detail[$i]['nid'] ?>')">
            <?echo $note?></div>
    </td>
    <td>
        <?if($detail[$i]['priority']=='普通'){ $priority_color = 'layui-bg-green';}?>
        <?if($detail[$i]['priority']=='紧急'){ $priority_color = '';}?>
        <span class="layui-badge <?echo $priority_color?>">
        <?echo $detail[$i]['priority']?>
        </span>
    </td>
    <td>
        <?if($detail[$i]['status']=='进行中'){ $status_color = 'layui-bg-blue';}?>
        <?if($detail[$i]['status']=='已完成'){ $status_color = 'layui-bg-green';}?>
        <?if($detail[$i]['status']=='待审核'){ $status_color = '';}?>
        <?if($detail[$i]['status']=='未开始'){ $status_color = 'layui-badge-rim';}?>
        <?if($detail[$i]['status']=='已删除'){ $status_color = 'layui-bg-gray';}?>
        <span class="layui-badge <?echo $status_color?>">
        <?echo $detail[$i]['status']?>
        </span>
    </td>
    <td>
<!--  <a href="detail-edit.php?sys_part=task&nid=--><?// echo $detail[$i]['nid']?><!--&nowpageid=--><?//echo $nowpageid?><!--" class="layui-btn  layui-btn-sm" >-->
<!--    <i class="layui-icon">&#xe642;</i>修改-->
<!--  </a>-->


    <a href="javascript:void(0)" onclick="delItem (<?php echo $detail[$i]['nid']?>,'task')"class="delete layui-btn  layui-btn-sm" > <i class="layui-icon">&#xe640;</i>删除
    </a>



    <a class="layui-btn  layui-btn-sm" onclick="window_eject('modules/mod-detail-edit.php?sys_part=task&nid=<? echo $detail[$i]['nid']?>&nowpageid=<? echo $_REQUEST['nowpageid'] ?>')">
        <i class="fa fa-bar-chart-o" aria-hidden="true"></i>信息

        <?php if($detail[$i]['notice_show'] == 1) {?><i class="notice_icon"></i><?php }?>
    </a>





  </td>
    </tr>
  <?php
}
?>



  </tbody>
</table>



    <?php
    if ($detailnum == 0)
    {
        echo "数据添加中";
    }
    ?>




</div>



    <!-- todo 这里需要做0判断-->
    <!-- 翻页代码-->
    <?php include ROOT_PATH_ . '/controller/common/module/mod_page_numbers.php'; ?>
</div>


<!--list-box end-->
</div>

<!--content端點01-->

<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>







<!--删除box-->
<?php include '../modules/deletebar.php'; ?>
<!--删除box end-->
<!--载入弹出窗口功能-->
<script type="text/javascript" src="/controller/common/asset/js/window_eject.js"></script>

<!--载入layer弹出元素功能-->
<script type="text/javascript" src="/controller/common/asset/js/layer_show_by_id.js"></script>


<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>

</body>

</html>




